﻿using System.ComponentModel;

namespace TripAssistantDesktop.ViewModel
{
    public class ViewModelBase : INotifyPropertyChanged, INotifyPropertyChanging
    {

        public ViewModelBase()
        {

        }



        //Here you need to have your DataLayer Manager object or BizLogic to access database

        //private DataManager _manager;
        //public DataManager Manager
        //{
        //    get
        //    {
        //        this._manager = this._manager ?? new DataManager();
        //        return this._manager; 
        //    }
        //}

        #region INotifyPropertyChanged Members

        private void OnPropertyChanged(string propertyName)
        {
            if(this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }
        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region INotifyPropertyChanging Members

        public void OnPropertyChanging(string propertyName)
        {
            if(this.PropertyChanging != null)
                this.PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
        }

        public event PropertyChangingEventHandler PropertyChanging;

        #endregion
    }
}
